﻿#region Usings & Copyright
/*================================================
 *= TemplateReader.cs (c)2009 Eagle Eye Studios  =
 *=         Written by Florian Vick              =
 *================================================
 */
using System;
using System.Collections.Generic;
using System.Text;
using Nini.Config;
#endregion

namespace Astudio.FileManagement.Template
{
    /// <summary>
    /// A class that reads Templates using DotNetConfigSource
    /// </summary>
    public class TemplateReader
    {
        #region Variables
        DotNetConfigSource reader;
#endregion

        #region Methods
        /// <summary>
        /// Creates a new instance of TemplateReader Class
        /// </summary>
        /// <param name="Filepath"></param>
        public TemplateReader(string Filepath)
        {
            reader = new DotNetConfigSource(Filepath);
        }
        /// <summary>
        /// Gets the Path of the BackgroundPic
        /// </summary>
        /// <param name="Path">Path of BG File</param>
        public string GetBackgroundPicPath()
        {
            string ret = reader.Configs["Template"].GetString("BackgroundPicture", "");
            return ret;
        }

        /// <summary>
        /// Reads the Name of the Template
        /// </summary>
        /// <param name="Name">Name of Template</param>
        public string GetTemplateName()
        {
            return reader.Configs["Template"].GetString("TemplateTitle", "Autorun Menü");
        }

        /// <summary>
        /// Reads a specific TemplateVersion
        /// </summary>
        public string GetTemplateVersion()
        {
            string ret = reader.Configs["Template"].GetString("TemplateVersion", "2.0");
            return ret;
        }

        /// <summary>
        /// Gets the XPosition of the Template Heading
        /// </summary>
        public int GetHeadingPositionX()
        {
            return reader.Configs["Template"].GetInt("HeadingPositionX", 0);
        }

        /// <summary>
        /// Gets the YPosition of the Template Heading
        /// </summary>
        public int GetHeadingPositionY()
        {
            return reader.Configs["Template"].GetInt("HeadingPositionY", 0);
        }
        /// <summary>
        /// Reads the Font of Menu's Heading
        /// </summary>
        public string GetHeadingFont()
        {
            return reader.Configs["Template"].GetString("HeadingFont", "Comic Sans MS");
        }

        /// <summary>
        /// Gets the Heading's Fontsize
        /// </summary>
        public int GetHeadingFontSize()
        {
            return reader.Configs["Template"].GetInt("HeadingFontSize", 12);
        }

        /// <summary>
        /// Gets the Slogan's Position
        /// </summary>
        public List<int> GetSloganPosition()
        {
            List<int> ret = new List<int>();
            ret.Add(reader.Configs["Template"].GetInt("SloganPositionX", 0));
            ret.Add(reader.Configs["Template"].GetInt("SloganPositionY", 0));
            return ret;
        }

        /// <summary>
        /// Reads the Slogan's Font's Name ;)
        /// </summary>
        /// <param name="Fontname">The Fontname</param>
        public string GetSloganFont()
        {
            return reader.Configs["Template"].GetString("SloganFont", "Arial");
        }

        /// <summary>
        /// Gets the Slogan's FontSize
        /// </summary>
        /// <param name="Fontsize">The Fontsize</param>
        public int GetSloganFontSize()
        {
            return reader.Configs["Template"].GetInt("SloganFontSize", 12);
        }

        /// <summary>
        /// Gets the Position of MainLabel
        /// </summary>
        public List<int> GetMainLabelPosition()
        {
            List<int> ret = new List<int>();
            ret.Add(reader.Configs["Template"].GetInt("MainLabelPositionX", 0));
            ret.Add(reader.Configs["Template"].GetInt("MainLabelPositionY", 0));
            return ret;
        }

        /// <summary>
        /// Gets The Font of The MainLabel
        /// </summary>
        /// <param name="Font">The Font</param>
        public string GetMainLabelFont()
        {
            return reader.Configs["Template"].GetString("MainLabelFont", "Microsoft Sans");
        }

        /// <summary>
        /// Reads the MainLabel's Fontsize
        /// </summary>
        public int GetMainLabelFontSize()
        {
           return reader.Configs["Template"].GetInt("MainLabelFontSize", 12);
        }

        /// <summary>
        /// Gets the HPLabel Position
        /// </summary>
        public List<int> GetHPLabelPosition()
        {
            List<int> ret = new List<int>();
            ret.Add(reader.Configs["Template"].GetInt("HPLabelPositionX", 0));
            ret.Add(reader.Configs["Template"].GetInt("HPLabelPositionY", 0));
            return ret;
        }

        /// <summary>
        /// Gets HPLabel Font
        /// </summary>
        public string GetHPLabelFont()
        {
            return reader.Configs["Template"].GetString("HPLabelFont", "Arial");
        }

        /// <summary>
        /// Gets HP Label Fontsize
        /// </summary>
        /// <returns></returns>
        public int GetHPLabelFontSize()
        {
            return reader.Configs["Template"].GetInt("HPLabelFontSize", 12);
        }

        /// <summary>
        /// Checks if the window is used
        /// </summary>
        /// <returns></returns>
        public string GetBorderstyle()
        {
            return reader.Configs["Template"].GetString("Borderstyle", "Sizable");
        }
        #endregion
    }
}
